package ca.jerg.data;

import java.util.ArrayList;

public interface IErgData
{
	/**
	 * Insert a single point at the end of the data
	 * file.
	 * 
	 * @param newPoint	the data point to insert
	 * @return true on success, false otherwise
	 */
	public boolean insert( ErgPoint newPoint );
	
	
	/**
	 * Insert a series of points (at least one) at the 
	 * end of the data file.
	 * 
	 * @param newData	the list of data points to insert
	 * @return true on success, false otherwise
	 */
	public boolean insert( ArrayList<ErgPoint> newData );
	
	
	/**
	 * Insert a single point into the data file
	 * at the time specified.  If the time already 
	 * exists in the file the point will be inserted
	 * as the last point at the specific time.
	 * 
	 * @param time 		the time at which to insert
	 * @param newPoint	the data point
	 * @return true on success, false otherwise
	 */
	public boolean insertAt( double time, ErgPoint newPoint );
	
	
	/**
	 * Insert a series of points (at least one) into the 
	 * data file at the time specified.  If the time already 
	 * exists in the file the point will be inserted
	 * as the last points at the specific time.
	 *  
	 * @param time		the time at which to insert
	 * @param newData	the list of data points
	 * @return true on success, false otherwise
	 */
	public boolean insertAt( double time, ArrayList<ErgPoint> newData );
	
	
	/**
	 * Remove all data points at the specified time index.
	 * If multiple data points exist with the same time index,
	 * a step function, they will all be removed.
	 * 
	 * @param time		the time at which to remove
	 * @return true on success, false otherwise
	 */
	public boolean remove( double time );
	
	/**
	 * Remove a number of data points starting at the specified
	 * time index.  If the number of specified data points is
	 * beyond the number of entries in the list the entries starting
	 * at the specified time to the end of the list will be removed
	 * from the list and <code>false</code> will be returned.  As an
	 * example:
	 * 
	 * Given a list of:
	 * 0.0 100
	 * 1.0 110
	 * 2.0 120
	 * 3.0 130
	 * 
	 * Calling <code>remove(2.0,3)</code> will remove the data points
	 * of (2.0,120) and (3.0,130) and return <code>false</code>.
	 * 
	 * Calling <code>remove(2.0,2)</code> will remove the same two
	 * data points but will return <code>true</code> since the number
	 * of items removed matched the number of items requested to be
	 * removed.
	 * 
	 * @param time		the time at which to remove
	 * @param number	the number of data points to remove
	 * @return true on success, false otherwise
	 */
	public boolean remove( double time, int number );
}
